﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Controls;

namespace Project
{
    public class LenghtValidationRule: ValidationRule
    {
        public int MinLenght { get; set; }

        public LenghtValidationRule(int minlenght)
        {
            MinLenght = minlenght;
        }
        public override ValidationResult Validate(object value, CultureInfo cultureInfo)
        {
            if((value as string).Length<MinLenght)
                return new ValidationResult(false, "El campo debe tener una longitud de al menos " + MinLenght+" caracteres");
            return new ValidationResult(true, null);
        }
    }
}
